package com.xjtu.weixin.controller.user;

import com.xjtu.weixin.service.TagService;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxMpUserTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * ${DESCRIPTION}
 *
 * @author 杨凯
 * @create 2018-08-29 15:02
 **/
@Controller
@RequestMapping("/tag")
public class TagController {

	@Autowired
	private TagService tagService;

	@GetMapping
	public String index(){
		return "admin/user/tag-list";
	}

	/**
	 * 创建标签
	 * @param tag
	 * @return
	 * @throws WxErrorException
	 */
	public ResponseEntity createTag(@RequestParam String tag) throws WxErrorException {
		tagService.createTag(tag);
		return new ResponseEntity(HttpStatus.OK);
	}
}
